<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="robots" content="all" />
    <meta http-equiv="imagetoolbar" content="no" />
    <meta http-equiv="pragma" Content="no-cach" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="format-detection" content="telephone=no" />
    <meta http-equiv="keywords" content="" />
    <meta name="author" content="" />
    <meta name="copyright" content="" />
    <meta name="description" content="" />
    <meta name="HandheldFriendly" content="true" />
    <title>经纪人-我的团队</title>
    <link rel="stylesheet" href="../css/mui.min.css">
    <link type="text/css" media="all" rel="stylesheet" href="../js/downdata/css/style.css" />
    <link type="text/css" media="all" rel="stylesheet" href="../js/downdata/css/dropload.css">

    <style>
        .tabHead span{
            width: 20%!important;
        }
        .tabHead .border{
            width: 20%!important;
        }
        .tabHead span:nth-child(2){
            width: 20%!important;
        }

    </style>
</head>
<body ontouchstart=""  id="container" style="font-size: 10px;">
<div class="headage"></div>
<div class="mui-content" >
    <div style="width: 100%;height: 35px;position: fixed;z-index: 5"  id="searchForm">
        <div class="mui-input-row mui-search" style="width: 70%;float: left;">
            <input type="search" id="searchInput"  class="mui-input-clear" placeholder="搜索" style="margin-left: 2px;">
        </div>
        <button type="button" class="mui-btn mui-btn-primary  mui-icon mui-icon-search" style="width: 27%;height: 34px;float: left;margin-left: 3px;" >搜索</button>
    </div>
    <article class="khfxWarp" style="background-color: #fff;margin-bottom: 60px;!important;margin-top: 0px;padding-top: 30px!important;">
        <section class="khfxPane" style="display:block">
        </section>
    </article>
    <div class="footerpage">
    </div>
</div>

<script src="../js/downdata/lib/jquery-2.2.3.min.js"></script>
<script src="../js/cookieutil.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/mui.min.js"></script>
<script src="../js/downdata/lib/dropload.js"></script>
<script src="../js/getUrlParam.js"></script>
</body>
</html>
<script>
    function onBridgeReady() {
        WeixinJSBridge.call('hideOptionMenu');
    }

    if (typeof WeixinJSBridge == "undefined") {
        if (document.addEventListener) {
            document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
        } else if (document.attachEvent) {
            document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
            document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
        }
    } else {
        onBridgeReady();
    }

    $(".headage").load("head.html");
    $(".footerpage").load("footer.html");
    var username="";
    var isdata=0;
    var typedata;
    var pagindex=0;
    var pagesize=10;
    var _url;
    typedata=getUrlParam("type");
    var  userid=getCookie('userid');
    mui('body').on('tap','a',function(){document.location.href=this.href;});

    function createFragment(me,username) {
        if (typedata==0)
        {
            _url='/User/findByupopenid';
            document.title = '经纪人-我的粉丝';
        }
        else {
            document.title = '经纪人-我的团队';
            _url='/User/findNoByUpopenid';
        }
        var  userid=getCookie('userid');
        var data = {
            upopenid: userid,
            level: 0,
            username:username
        };
        var result = '';
        //请求后台数据
        mui.post(_url, data, function (info) {
            console.log(info);
            var datas = info.object;
            document.title=    document.title+datas.length+"人";
            if(datas.length === 0){
                me.lock();
                me.noData();
                me.resetload();
                return;
            }else {
                for (var i = 0; i < datas.length; i++) {
                    cold = datas[i];
                    result
                    += ''
                        + '    <hgroup class="khfxRow">'
                        + '      <header>姓名：'+cold['username']+'</header>'
                        + '      <div class="mid">'
                        + '        <img class="photo" src="'+cold['avatar']+' ">'
                        + '        <span><label>类型：</label>'+getusertypedata(cold['level'])+'</span> '
                        + '        <span><label>电话：</label>'+cold["mobile"]+'</span> '
                        + '        <span style="width: 100%!important;"><label>注册时间：</label>'+formattimeuser(cold['createtime'])+'</span> '
                        + '        <span style="width: 100%!important;"><label>最近时间：</label>'+formattimeuser(cold['jointime'])+'</span> '
                        + '        <span style="width: 100%!important;"><label>访问次数：</label>'+cold['maxsuccessions']+'次</span> '
                        + '      </div>'
                        + '      <footer></footer>'
                        + '    </hgroup>';
                }
                $('.khfxPane').eq(0).append(result);
                if(datas.length <10){
                    me.lock();
                    me.noData();
                    me.resetload();
                    me.$domDown.html(me.opts.domDown.domNoData);
                }
                else {
                    me.$domDown.html(me.opts.domDown.domRefresh);
                }


                pagindex=pagindex+10;
                pagesize=pagesize+10;
            }

        });

    };



    $(function () {
        var dropload = $('.khfxWarp').dropload({
            scrollArea: window,
            domDown: {
                domClass: 'dropload-down',
                domRefresh: '<div class="dropload-refresh">上拉加载更多</div>',
                domLoad: '<div class="dropload-load"><span class="loading"></span>加载中...</div>',
                domNoData: '<div class="dropload-noData">已无数据</div>'
            },
            loadDownFn: function (me) {
                setTimeout(function () {
                    createFragment(me,"");
                }, 500);
            }
        });
        $('#searchForm button').on('click', function () {
            username = document.getElementById('searchInput').value;
            if (username==""||username==undefined||username==null) {
                username="";
            }

                $('.khfxPane hgroup').remove();
                pagindex=0;
                pagesize=10;
                createFragment(dropload,username);

        });
    });

</script>